(in-package :TRAPS)
; Generated from #P"macintosh-hd:hd3:CInterface Translator:Source Interfaces:Geometry.h"
; at Sunday July 2,2006 7:25:29 pm.
; 
;  *  Geometry.h
;  *  vImage_Framework
;  *
;  *  Copyright (c) 2002 Apple Computer. All rights reserved.
;  *
;  
; 
;  *
;  *	This suite of functions allows the caller to rotate, resize and distort images. Resampling
;  *	is currently done with a Lanczos kernel.
;  *
;  *	The 90 degree rotate function requires that the corresponding destination axes share the 
;  *	same even/odd parity for size as the source buffer. Otherwise, the image may become uncentered
;  *	by a half a pixel. For example if the input buffer has a width of 3 and a height of 4, and you rotate
;  *	90 degrees, the destination buffer should have a even width (4 is even) and a odd height (3 is odd). 
;  *	For a 180 degree rotate, the width would have to be odd and the height even. 
;  *
;  *	Set the vImageEdgeExtend flag if you wish to use the edge pixels of the image as the color of regions
;  *	outside the input vImage_Buffer. In general, this is not a good idea, however if you are just resizing, 
;  *	it will prevent the background color from bleeding into the edges of the image. 	
;  *
;  *	The kvImageLeaveAlphaUnchanged flag is ignored for this set of functions, since most of these 
;  *	functions involve a high degree of resampling. It is not clear in most cases what the
;  *	appropriate "unchanged" value would be to use.
;  *
;  
; #ifndef VIMAGE_GEOMETRY_H
; #define VIMAGE_GEOMETRY_H

(require-interface "vImage/vImage_Types")
; #ifdef __cplusplus
#| #|
extern "C" {
#endif
|#
 |#
; Rotation constants for use with Rotate_90_*

(defconstant $kRotate0DegreesClockwise 0)
(defconstant $kRotate90DegreesClockwise 3)
(defconstant $kRotate180DegreesClockwise 2)
(defconstant $kRotate270DegreesClockwise 1)
(defconstant $kRotate0DegreesCounterClockwise 0)
(defconstant $kRotate90DegreesCounterClockwise 1)
(defconstant $kRotate180DegreesCounterClockwise 2)
(defconstant $kRotate270DegreesCounterClockwise 3)
; 
;  * High Level Geometry Functions
;  * ----------------------------
;  * vImage provides a set of high level geometry functions to do simple geometric transforms on an image. 
;  * These are:
;  *
;  *	Rotate -- rotate the input image around a center point by any amount and write to a destination buffer.
;  *	Scale  -- resize the input image to the size of the destination buffer
;  *	Affine Transform -- Apply an affine transform to an image
;  *
;  * When calling the Rotate and Affine Transform functions, it is possible that some part of the output 
;  * image may come from regions of the input image that are outside the original input image. In these cases,
;  * the "revealed" pixels will be of the color provided in the backgroundColor parameter passed to the function,
;  * unless vImageEdgeExtend is passed, in which case it will be taken from the nearest edge pixel. 
;  *
;  * The Scaling function may need to read outside the edges of the input buffer to service the resampling kernel.
;  * In this case the values of the edge pixels a replicated outward infinitely. This allows us to avoid having
;  * the background color bleed into the edges of the image. If you wish to rescale part of an image and have the rest
;  * of the image considered for this operation, use the Affine Transform for scaling. 
;  *
;  * Temporary Buffers
;  * -----------------
;  * The high level geometry functions cannot operate in place and cannot operate simply within the confines of the 
;  * source and destination buffers. This is because they employ multipass algorithms that need to save 
;  * intermediate pixel values between passes. The destination buffer may not be large enough to hold that
;  * information or later passes may not operate correctly in place, meaning that additional storage is 
;  * required. Temporary storage is required by the higher level Geometry operations: Rotate, Scale, 
;  * and Affine Transform. 
;  * 
;  * Even though temporary storage is required by these functions, you may pass NULL for the pointer to
;  * a temporary buffer. This may cause vImage to call malloc to allocate a buffer for you. It will 
;  * be destroyed before the function returns to prevent a memory leak. This is a perfectly sensible thing
;  * to do when the function is not called often and possibly blocking on a lock for a short period of time
;  * is not a problem. (Malloc may block on a lock.)
;  *
;  * If you plan to call the function frequently over a relatively short period of time, or you need real time 
;  * performance guarantees (which make locks a problem) then you should preallocate your own temporary 
;  * working buffer for vImage to use and reuse that. This will avoid the per-call malloc overhead, helping 
;  * to guarantee top performance. In addition, it avoids a problem caused by the fact that large 
;  * (i.e. image sized) buffers allocated by malloc are usually allocated by the OS in a paged-out state. 
;  * (They are not on disk. They do not physically exist until you touch the page, at which point they are 
;  * allocated and zero filled on demand.) This means that as we touch each new 4k page we take an interrupt to zero fill 
;  * the page, which would be nice to avoid. If you call the vImage function rarely, this is not worth worrying 
;  * about, since whatever buffer you preallocate is likely to be paged out to disk by the VM system anyway. 
;  * It is just on the 2nd and later calls in quick succession that this is a performance win, since we can 
;  * avoid the paging activity.
;  *
;  * You may allocate the temporary buffer anywhere you like -- heap, global, stack, etc. The buffer should 
;  * be at least the size returned by vImageGetMinimumGeometryTempBufferSize() for the source and destination buffers.
;  * Be aware that the stack size limit is user configurable and in many cases may not be large enough.
;  * The buffer should not be shared reentrantly between different threads in a multithreaded app, unless you
;  * protect it with a mutual exclusion device such as a lock/mutex/etc. Otherwise two vImage functions may
;  * overwrite each other and produce garbled image data. No information is kept in the temporary buffer 
;  * between function calls. 
;  

(deftrap-inline "_vImageRotate_Planar8" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (angleInRadians :single-float)
    (backColor :UInt8)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageRotate_PlanarF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (angleInRadians :single-float)
    (backColor :single-float)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageRotate_ARGB8888" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (angleInRadians :single-float)
    (backColor (:pointer :PIXEL_8888))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageRotate_ARGBFFFF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (angleInRadians :single-float)
    (backColor (:pointer :PIXEL_FFFF))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageScale_Planar8" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageScale_PlanarF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageScale_ARGB8888" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageScale_ARGBFFFF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageAffineWarp_Planar8" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (transform (:pointer :VIMAGE_AFFINETRANSFORM))
    (backColor :UInt8)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageAffineWarp_PlanarF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (transform (:pointer :VIMAGE_AFFINETRANSFORM))
    (backColor :single-float)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageAffineWarp_ARGB8888" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (transform (:pointer :VIMAGE_AFFINETRANSFORM))
    (backColor (:pointer :PIXEL_8888))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageAffineWarp_ARGBFFFF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (tempBuffer :pointer)
    (transform (:pointer :VIMAGE_AFFINETRANSFORM))
    (backColor (:pointer :PIXEL_FFFF))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )
; 
;  *	For the Affine Transform function the coordinate space places the origin at the bottom left corner
;  * 	of the image. Positive movement in the X and Y direction moves you right and up. Both source and destination
;  *	images are assumed to place their bottom left hand corner at the origin. 
;  
;  
;  * vImageGetMinimumGeometryTempBufferSize() returns the minimum size of a temporary buffer passed to any of the Rotate, Scale
;  * or Affine Transform functions. The size is only dependent on the height and width of the two buffers, and the
;  * number of bytes per pixel (the data format). The rowbytes and data fields are ignored. As long as the size
;  * of the buffers doesn't change, the size returned by  GetMinimumTempBufferSize() will not change. 
;  

(deftrap-inline "_vImageGetMinimumGeometryTempBufferSize" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (flags :UInt32)
    (bytesPerPixel :unsigned-long)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :unsigned-long
() )
; 
;  *	Low Level Geometry Functions
;  *	----------------------------
;  *
;  *	vImage also provides a series of low level geometry functions that do simple, often 1-D, transforms on images. 
;  *	They are:
;  *
;  *		Reflect -- reflect an image across a  mirror plane at the center of the image in the x or y direction
;  *		Shear --  shear and rescale an image in the x or y direction
;  *		Rotate90 -- rotate an image by 0, 90, 180 or 270 degrees
;  *
;  *	The Reflect functions simply reflect images horizontally or vertically. Horizontal reflection inverts the image
;  *	left to right. Vertical reflection causes the image to appear upside down as if seen from behind.
;  

(deftrap-inline "_vImageHorizontalReflect_Planar8" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageHorizontalReflect_PlanarF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageHorizontalReflect_ARGB8888" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageHorizontalReflect_ARGBFFFF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageVerticalReflect_Planar8" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageVerticalReflect_PlanarF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageVerticalReflect_ARGB8888" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageVerticalReflect_ARGBFFFF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )
; 
;  * 	The Rotate90 function does simple 0, 90, 180 or 270 degree rotation according to the value of a rotation constant
;  *	passed to it. The images are rotated about their center. If the source and destination sizes do not match, parts 
;  *	of the image may be cut off. Other parts may have no image, in which case the background color will be drawn there.
;  *
;  *	CAUTION: 90 and 270 degree rotation does not rotate about the true center of the image if the height of the source image  
;  *	is an odd number of pixels and the width of the destination image an even number of pixels, or vice versa. This is also 
;  *	true of the source width and destination height. In this case, you should use the High level rotate function for 90 or 
;  *	270 rotates so that the resampling can be done to shift the image a half pixel for proper centering. It may be somewhat 
;  *	faster to widen the destination image by 1 and use the low level shearing functions to resample the image at a a half pixel offset.
;  *	For 0 and 180 degree rotates, if the source and destination buffers are a different size, the two heights must have matching
;  *	even/oddness and the two widths must have matching even/oddness. Otherwise the image will be rotated and shifted a half pixel 
;  *	away from the center. 
;  *
;  *	rotationConstant:	0 -- rotate 0 degrees (simply copy the data from src to dest)
;  *				1 -- rotate 90 degrees counterclockwise
;  *				2 -- rotate 180 degress
;  *				3 -- rotate 270 degrees counterclockwise
;  *
;  *	backColor:	The color of the background. This color will be copied to any place where pixels are revealed because
;  *			the input image does not completely cover the output image. 
;  

(deftrap-inline "_vImageRotate90_Planar8" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (rotationConstant :UInt8)
    (backColor :UInt8)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageRotate90_PlanarF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (rotationConstant :UInt8)
    (backColor :single-float)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageRotate90_ARGB8888" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (rotationConstant :UInt8)
    (backColor (:pointer :PIXEL_8888))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageRotate90_ARGBFFFF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (rotationConstant :UInt8)
    (backColor (:pointer :PIXEL_FFFF))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )
; 
;  *	The Shearing functions use resampling to rescale a image and offset it to fractional pixel offsets. 
;  *	The functions actually shear, resize in one dimension and translate. All of it is done with fractional
;  *	pixel precision. The shear angle is set using the angleInRadians parameter. It is measured as clockwise
;  *	rotation of the leading edge away from the x or y axis. The xTranslate and yTranslate variables may be used
;  *	to adjust the position of the destination image in the x and y directions. Scaling (making the image larger or
;  *	smaller in one dimension) is done by adjusting the resampling kernel.
;  

(deftrap-inline "_vImageHorizontalShear_Planar8" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (srcOffsetToROI_X :UInt32)
    (srcOffsetToROI_Y :UInt32)
    (xTranslate :single-float)
    (shearSlope :single-float)
    (filter (:pointer :void))
    (backColor :UInt8)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageHorizontalShear_PlanarF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (srcOffsetToROI_X :UInt32)
    (srcOffsetToROI_Y :UInt32)
    (xTranslate :single-float)
    (shearSlope :single-float)
    (filter (:pointer :void))
    (backColor :single-float)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageHorizontalShear_ARGB8888" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (srcOffsetToROI_X :UInt32)
    (srcOffsetToROI_Y :UInt32)
    (xTranslate :single-float)
    (shearSlope :single-float)
    (filter (:pointer :void))
    (backColor (:pointer :PIXEL_8888))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageHorizontalShear_ARGBFFFF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (srcOffsetToROI_X :UInt32)
    (srcOffsetToROI_Y :UInt32)
    (xTranslate :single-float)
    (shearSlope :single-float)
    (filter (:pointer :void))
    (backColor (:pointer :PIXEL_FFFF))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageVerticalShear_Planar8" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (srcOffsetToROI_X :UInt32)
    (srcOffsetToROI_Y :UInt32)
    (yTranslate :single-float)
    (shearSlope :single-float)
    (filter (:pointer :void))
    (backColor :UInt8)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageVerticalShear_PlanarF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (srcOffsetToROI_X :UInt32)
    (srcOffsetToROI_Y :UInt32)
    (yTranslate :single-float)
    (shearSlope :single-float)
    (filter (:pointer :void))
    (backColor :single-float)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageVerticalShear_ARGB8888" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (srcOffsetToROI_X :UInt32)
    (srcOffsetToROI_Y :UInt32)
    (yTranslate :single-float)
    (shearSlope :single-float)
    (filter (:pointer :void))
    (backColor (:pointer :PIXEL_8888))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageVerticalShear_ARGBFFFF" 
   ((src (:pointer :VIMAGE_BUFFER))
    (dest (:pointer :VIMAGE_BUFFER))
    (srcOffsetToROI_X :UInt32)
    (srcOffsetToROI_Y :UInt32)
    (yTranslate :single-float)
    (shearSlope :single-float)
    (filter (:pointer :void))
    (backColor (:pointer :PIXEL_FFFF))
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )
; 
;  *	The shearing functions use a resampling filter for their work. Before you call these functions you must 
;  *	create a new filter. The filter must be remade for different scaling factors, but may be reused in different
;  *	function calls if the scaling factor is the same. 
;  *
;  * 	For general purpose work, use NewResamplingFilter() to create a resampling filter. It currently uses 
;  *	either Lanczos3 or Lanczos5 filter, depending on whether the kvImageHighQualityResampling bit is set in the flags field. 
;  *	What filter is used is subject to change. 
;  *
;  *		ResamplingFilter kernel = NewResamplingFilter( theScale, kvImageHighQualityResampling );
;  *
;  *	Use DestroyResamplingFilter() when you are done with the filter to return the memory it uses to the heap.
;  *
;  *	The scale parameter sets the level of rescaling to be done. A value of 1.0f leaves the image at its 
;  *	original size. 2.0f will magnify in one direction to make the image twice as wide / tall. 0.5f will 
;  *	make it half as wide / tall. Any float is allowed, including negative values, which will have the effect
;  *	of flipping the image along that axis. Scaling will happen relative to the left or bottom edge of the image. 
;  *
;  *	Set the kvImageEdgeExtend bit in the flags field if you would like the image buffer edges extended infinitely
;  *	rather than use the backColor value. This is useful when you do not wish a background color to bleed into
;  *	the edges of your image. This is generally only useful when the shear angle is 0.
;  *
;  

(deftrap-inline "_vImageNewResamplingFilter" 
   ((scale :single-float)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   (:pointer :void)
() )

(deftrap-inline "_vImageDestroyResamplingFilter" 
   ((filter (:pointer :void))
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :void
() )
; 
;  *	vImageNewResamplingFilter and vImageDestroyResamplingFilter are merely convenience functions to make
;  *	the common case of the default resampling filter into a heap allocated buffer easier for you.
;  *
;  *	If you would like to use your own special purpose resampling filter or need to restrict your use of malloc, 
;  *	you may instead call NewResamplingFilterForFunctionUsingBuffer(), which creates a filter for a specific 
;  *	resampling filter function that you provide in the form of a simple y = f(x) function, and writes it into a buffer
;  *	that you provide. This function writes the kernel values into a preallocated kernel buffer that you provide. The 
;  *	kernel buffer should be at least the size of the kernel data, which is given by vImageGetResamplingKernelSize.
;  *
;  

(deftrap-inline "_vImageNewResamplingFilterForFunctionUsingBuffer" 
   ((filter (:pointer :void))
    (scale :single-float)
    (kernelFunc (:pointer :callback))           ;(void (const float * xArray , float * yArray , unsigned int count , void * userData))

    (kernelWidth :single-float)
    (userData :pointer)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :SInt32
() )

(deftrap-inline "_vImageGetResamplingFilterSize" 
   ((scale :single-float)
    (kernelFunc (:pointer :callback))           ;(void (const float * xArray , float * yArray , unsigned int count , void * userData))

    (kernelWidth :single-float)
    (flags :UInt32)
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   :unsigned-long
() )
; 
;  *	The scale parameter is the amount to enlarge or reduce the output image. It is the same meaning
;  *	as for the generic resampling kernel.
;  *
;  *	The kernelFunc defines the shape of the resampling kernel. Here is a sample kernelFunc that does 
;  *	linear interpolation:
;  *
;  *		void MyLinearInterpolationFilterFunc( const float *xArray, float *yArray, int count, void *userData )
;  *		{
;  *			int i;
;  *			float sum = 0.0f;
;  *
;  *			//Calculate kernel values
;  *			for( i = 0; i < count; i++ )
;  *			{
;  *				float unscaledResult = 1.0f - fabs( xArray[i] );	//LERP
;  *				yArray[i] = unscaledResult;
;  *				sum += unscaledResult;		
;  *			}
;  *
;  *			//Make sure the kernel values sum to 1.0. You can use some other value here. 
;  *			//Values other than 1.0 will cause the image to lighten or darken.
;  *			sum = 1.0f / sum;
;  *			for( i = 0; i < count; i++ )
;  *				yArray[i] *= sum;
;  *			
;  *		}
;  *
;  *	This specifies the tent line shape centered around 0.0f that defines a linear interpolation kernel. 
;  *	The array of values you will be asked to provide are the entire resampling window for a single pixel.
;  *	The x values are pixel positions relative to the result, and the y values are where you should put
;  *	the kernel values for those positions. The x values will range from -kernelWidth to kernelWidth.
;  *
;  *	The array format is used for efficiency, and also to give you the opportunity to make sure the kernel 
;  *	adds up to 1.0 or some other desired value. Making sure that the kernel values add up to 1.0 will
;  *	prevent interference patterns from emerging in the image. Since the sampling kernel function itself is 
;  *	sampled during the process of pairing kernel values against sampled pixel data, the sampled kernel data 
;  *	does not always integrate to the same value that the parent function does, so usually we must normalize 
;  *	it to prevent interference/moiree patterns from to emerging in the image as the pixels in the input buffer 
;  *	drift in and out of phase with those in the output buffer. Sums less than 1.0f will cause the image to 
;  *	darken. Gain values greater than 1.0 may cause significant clipping for integer pixel data. Kernel values 
;  *	are clipped at approximately +- 2.0 for all integer data. If your filter function values exceed +- 2.0, then
;  *	you will need to use the floating point data format to avoid overflow. 
;  *
;  *	If you pass NULL for the kernelFunc, vImage will use its default resampling kernel. You can control 
;  *	whether the high quality resampling kernel is used or not by setting the kvImageHighQualityResampling 
;  *	bit in the flags field. This allows you to use the default resampling kernel in your own buffer. If you do
;  *	not pass NULL for the kernelFunc, the kernelFunc and your userData parameter must be valid for the lifetime
;  *	of the ResamplingKernel. 
;  *
;  *	The kernelWidth parameter controls the limiting values of x, when creating the new kernel. A kernelWidth 
;  *	of 1.0 would allow input samples between -1.0 and 1.0 pixels away from the destination pixel to influence 
;  *	the result. For Lanczos3, we would use a kernelWidth of 3.0f, because the Lanczos3 function is defined 
;  *	over the range -3.0f to 3.0f. If your function is only defined over part of the range -x...x, then have 
;  *	your function return zero for the rest of the function. The computational cost of the shearing functions 
;  *	is proportional to the kernelWidth. 
;  *
;  *	The userData field is passed back unchanged to your kernelFunc when it is called. 
;  *
;  *	The only flag honored by this function in this release is kvImageHighQualityResampling, which is only
;  *	used if NULL is passed for the kernelFunc to decide whether to use the normal or high quality default
;  *	resampling filter. Except in this case, you should in general pass kvImageNoFlags in the flags field 
;  * 	to avoid conflicting with future implementations where flags may be used. 
;  *
;  *	Do not use DestroyResamplingKernel() to free the memory used by kernels created with NewResamplingKernelForFunction().
;  *	Since you are responsible for allocating that buffer, you are also responsible for destroying it, using the matching
;  *	free function. 
;  *
;  *	Do not call vImageNewResamplingKernelForFunctionUsingBuffer() on a buffer created with vImageNewResamplingKernel().
;  *	The buffer sizes may be different. You must use vImageGetResamplingKernelSize() to find out the new buffer size,
;  *	allocate a buffer yourself using something like malloc(), then call vImageNewResamplingKernelForFunctionUsingBuffer().
;  
; #ifdef __cplusplus
#| #|
}
#endif
|#
 |#

; #endif


(provide-interface "Geometry")